package com.dragon.repository.mapper;

import com.dragon.repository.entity.RefundProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 退款产品表 Mapper 接口
 * </p>
 *
 * @author sy
 * @since 2024-01-09
 */
@Mapper
public interface RefundProductMapper extends BaseMapper<RefundProduct> {


    @Select("SELECT a.*,bb.`name` AS name, bb.material as vProductMaterial, ddd.name as unitName, bb.specification as specification, bb.remark AS vProductRemark   FROM dragon_refund_product a " +
            "LEFT JOIN dragon_vendor_products bb ON  a.product_id = bb.id " +
            "LEFT JOIN dragon_dictsort_detail ddd ON ddd.code_type = 'unitCode' AND bb.unit = ddd.id " +
            "  WHERE a.refund_id = #{id}")
    List<RefundProduct> selectProductDetailByList(Integer id);

}
